package com.zb.vo;

import com.zb.annotation.NumberPattern;
import com.zb.utils.VerificUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/10/26 0026
 **/
@Data
@ApiModel("工单备件对象")
public class WorkSpareVo {

    @ApiModelProperty(value = "工单备件ID，新增不必传，修改必传")
    private Long id;

    @NotNull(message = "工单ID不能为空")
    @ApiModelProperty(value = "工单ID", required = true)
    private Long workId;

    @NumberPattern(regexp = "^(1|2)$", required = true, message = "申请类型参数不合法")
    @ApiModelProperty(value = "申请类型：1-商家/总部配件，2-外部配件", required = true, example = "1")
    private Integer type;

    @NumberPattern(regexp = "^(0|1|2|3)$", required = true, message = "申请类型参数不合法")
    @ApiModelProperty(value = "服务商配件类型：1-服务商-外部仓配件，2-工程师-外部仓配件，3-自购备件", required = true, example = "0")
    private Integer networkSpareType;

    @Length(max = 200, message = "备注长度限制 200 个字符")
    @ApiModelProperty(value = "备注")
    private String remark;

    @NotNull(message = "收货地址类型不能为空")
    @NumberPattern(regexp = "^(1|2)$", required = true, message = "收货地址类型参数不合法")
    @ApiModelProperty(value = "收货地址类型：1-工单客户地址，2-服务商地址", required = true, example = "1")
    private Integer receiptAddrType;

    @NotNull(message = "用户/网点ID不能为空")
    @ApiModelProperty(value = "用户/网点ID", required = true)
    private Long userOrNetworkId;

    @NotBlank(message = "收货人姓名不能为空")
    @Length(max = 100, message = "收货人姓名长度限制 100 个字符")
    @ApiModelProperty(value = "收货人姓名", required = true)
    private String receiptName;

    @NotBlank(message = "收货人手机号不能为空")
    @Pattern(regexp = VerificUtil.REGEX_PHONE, message = "手机号格式输入错误")
    @ApiModelProperty(value = "收货人手机号", required = true)
    private String receiptPhone;

    @NotBlank(message = "收货地址-省不能为空")
    @Length(max = 50, message = "收货地址-省长度限制 50 个字符")
    @ApiModelProperty(value = "收货地址-省", required = true)
    private String receiptProvince;

    @NotBlank(message = "收货地址-市不能为空")
    @Length(max = 50, message = "收货地址-市长度限制 50 个字符")
    @ApiModelProperty(value = "收货地址-市", required = true)
    private String receiptCity;

    @NotBlank(message = "收货地址-县/区不能为空")
    @Length(max = 50, message = "收货地址-县/区长度限制 50 个字符")
    @ApiModelProperty(value = "收货地址-县/区", required = true)
    private String receiptArea;

    @Length(max = 50, message = "收货地址-镇长度限制 50 个字符")
    @ApiModelProperty(value = "收货地址-镇", example = "")
    private String receiptTown;

    @NotBlank(message = "收货人详细地址不能为空")
    @Length(max = 200, message = "收货人详细地址长度限制 200 个字符")
    @ApiModelProperty(value = "收货人详细地址")
    private String receiptAddress;

    @Valid
    @NotNull(message = "工单备件物料对象不能为空")
    @NotEmpty(message = "工单备件物料对象不能为空")
    @Size(min = 1, message = "工单备件物料对象至少填写一项")
    @ApiModelProperty(value = "工单备件物料对象")
    private List<WorkSpareMaterialVo> spareMaterialVos;

    @ApiModelProperty(value = "删除的工单备件物料对象")
    private List<Long> delSpareMaterialIds;
}
